<template>
	<view>

		<!--pages/personal/personal.wxml-->
		<view class="box">
			<u-skeleton :loading="isLoading" rows="17">
				<!-- <u-skeleton title avatar :loading="loading " row="17"> -->


				<view class="content">
							
					<view class="header">
						<view class="headshot">
							<u-avatar :src="src"  size="70"></u-avatar>
						</view>
						
						<view class="head-right">
								<!-- <u-cell-group :customStyle="{'fontWeight': '600'}">
									<u-cell>
										<view slot="title">
									
											<view style="float: left;">
												<text class="u-cell-text">{{user.name}}</text>
											</view>
									
											<view style="float: right;">
												<text class="u-cell-text" style="color: rgb(150, 151, 153);">
													<view class="y_tag y_tag_bgPrimary floatright mlw">
														{{user.orgs[0].oname}}
													</view>
													
													</text>
											</view>
									
										</view>
									</u-cell>
									
									<u-cell>
										<view slot="title">
									
											<view style="float: left;">
												<text class="u-cell-text" style="font-weight: 500;">{{user.account}}</text>
											</view>
									
											<view style="float: right;">
												<text class="u-cell-text" style="color: rgb(150, 151, 153);">
													
													<view class="y_tag y_tag_bgPrimary floatright mlw">
														0积分
													</view>
													</text>
											</view>
									
										</view>
									</u-cell>
									
								</u-cell-group> -->
								
								
								<view class="y_cell">
									
									<view class="y_cell_left">
										<view style="float: left;">
											<text class="u-cell-text" style="font-weight: 600;">{{user.name}}</text>
											
											
										</view>
									</view>
									
									<view class="y_cell_right">
										<view style="float: left;">
											
											<view class="y_tag floatright y_tag_bgPrimary mlw">
										{{user.orgs[0].oname}}
											</view>
											
										</view>
										
									</view>
								</view>
								
								<view class="y_cell">
									
									<view class="y_cell_left" style="border-bottom: none !important;">
										<view style="float: left;">
											<text class="u-cell-text" style="font-weight: 600;">{{user.account}}</text>
											
											
										</view>
									</view>
									
									
									<view class="y_cell_right">
										<view style="float: left;">
											
											<view class="y_tag floatright y_tag_bgPrimary mlw">
											0积分
											</view>
											
										</view>
										
									</view>
									
									
								</view>
								
								
								
						</view>	
							
					</view>


					<view class="myexam">
						考试测验
					</view>
					<!-- <yb-tag list="{{list}}"></yb-tag> -->
					<view class="">



						<!-- <u-cell-group :customStyle="{'fontWeight': '600'}">
							<u-cell>
								<view slot="title">

									<view style="float: left;">
										<text class="u-cell-text">考试数</text>
									</view>

									<view style="float: right;">
										<text class="u-cell-text" style="color: rgb(150, 151, 153);">
											<view class="y_tag  floatright mlw">
												{{examInfo.examCount}}次
											</view>
											</text>
									</view>

								</view>
							</u-cell>


							<u-cell>
								<view slot="title">

									<view style="float: left;">
										<text class="u-cell-text">平均分</text>
									</view>

									<view style="float: right;">
										<text class="u-cell-text" style="color: rgb(150, 151, 153);">
											<view class="y_tag  floatright mlw">
												{{examInfo.examAvgScore}}分
											</view>
											</text>
									</view>

								</view>
							</u-cell>


							<u-cell>
								<view slot="title">

									<view style="float: left;">
										<text class="u-cell-text">正确率</text>
									</view>

									<view style="float: right;">
										<text class="u-cell-text" style="color: rgb(150, 151, 153);">
											<view class="y_tag  floatright mlw">
												{{examInfo.examRightPercent}}%
											</view>
											</text>
									</view>

								</view>
							</u-cell>

							<u-cell>
								<view slot="title">

									<view style="float: left;">
										<text class="u-cell-text">不及格</text>
									</view>

									<view style="float: right;">
										<text class="u-cell-text" style="color: rgb(150, 151, 153);">
											<view class="y_tag  floatright mlw">
												{{examInfo.examNotPassCount}}次
											</view>
											</text>
									</view>

								</view>
							</u-cell>
							
							<u-cell>
								<view slot="title">
							
									<view style="float: left;">
										<text class="u-cell-text">缺考数</text>
									</view>
							
									<view style="float: right;">
										<text class="u-cell-text" style="color: rgb(150, 151, 153);">
											<view class="y_tag  floatright mlw">
												{{examInfo.examAbsentCount}}次
											</view>
											</text>
									</view>
							
								</view>
							</u-cell>

						</u-cell-group> -->
						
						
						
						
						<view class="">
							<view class="head">
								<view class="y_cell">
									
									<view class="y_cell_left">
										<view style="float: left;">
											<text class="u-cell-text" style="font-weight: 600;">考试数</text>
											
											
										</view>
									</view>
									
									<view class="y_cell_right">
										<view style="float: left;">
											
											<view class="y_tag floatright y_tag_bgPrimary mlw">
												{{examInfo.examCount}}次
											</view>
											
										</view>
										
									</view>
								</view>
								
								<view class="y_cell">
									
									<view class="y_cell_left">
										<view style="float: left;">
											<text class="u-cell-text" style="font-weight: 600;">平均分</text>
											
											
										</view>
									</view>
									
									<view class="y_cell_right">
										<view style="float: left;">
											
											<view class="y_tag floatright y_tag_bgPrimary mlw">
											{{examInfo.examAvgScore}}分
											</view>
											
										</view>
										
									</view>
								</view>
								
								<view class="y_cell">
									
									<view class="y_cell_left">
										<view style="float: left;">
											<text class="u-cell-text" style="font-weight: 600;">正确率</text>
											
											
										</view>
									</view>
									
									
									<view class="y_cell_right">
										<view style="float: left;">
											
											<view class="y_tag floatright y_tag_bgPrimary mlw">
											{{examInfo.examRightPercent}}%
											</view>
											
										</view>
										
									</view>
									
									
								</view>
								
								
								
								<view class="y_cell">
									
									<view class="y_cell_left">
										<view style="float: left;">
											<text class="u-cell-text" style="font-weight: 600;">不及格</text>
											
											
										</view>
									</view>
									
									
									<view class="y_cell_right">
										<view style="float: left;">
											
											<view class="y_tag floatright y_tag_bgPrimary mlw">
											{{examInfo.examNotPassCount}}次
											</view>
											
										</view>
										
									</view>
									
									
								</view>
								
								<view class="y_cell">
									
									<view class="y_cell_left">
										<view style="float: left;">
											<text class="u-cell-text" style="font-weight: 600;">缺考数</text>
											
											<!-- <view class="y_tag floatright mlw">
												{{examInfo.examRightPercent}}%
											</view> -->
											
										</view>
									</view>
									
									
									<view class="y_cell_right">
										<view style="float: left;">
											<view class="y_tag floatright y_tag_bgPrimary mlw">
											{{examInfo.examAbsentCount}}次
											</view>
											
										</view>
										
									</view>
									
									
								</view>
								
								
							</view>
						</view>
						
						
					</view>

					<view style="margin-top: 40rpx;">
						<u-button type="error" style="width: 96%;" @click="unBindUser">解除绑定</u-button>
					</view>




				</view>
			</u-skeleton>
			<!-- </u-skeleton> -->
		</view>

	</view>
</template>

<script>
	import {
		getUserStatistics,
		GetPracticeStatistics,
	} from '../../api/exam';
	import {
	UnBindUser
	} from '../../api/login';
	export default {
		data() {
			return {
				user: {},
				examInfo: {},
				isLoading: true,
				src: 'https://cdn.uviewui.com/uview/album/1.jpg',
			}
		},
		onLoad() {

		},
		onShow() {
			this.bindData();
		},
		methods: {
			unBindUser(){
				uni.showLoading({
					title:"请稍后"
				});
				UnBindUser().then((res)=>{
					uni.hideLoading();
					if(res.result===0){
						uni.removeStorageSync("user");
						uni.removeStorageSync("token");
						uni.removeStorageSync("appid");
						uni.reLaunch({
							url:"/pages/login/login"
						})
					}
				})
			},
			bindData() {
				let user = JSON.parse(uni.getStorageSync("user"));
				this.user = user;

				getUserStatistics({}).then((res) => {
					if (res.result === 0) {
						this.examInfo = res.data;
						this.isLoading = false;
					}
				})

			}
		}
	}
</script>

<style>
	/* pages/personal/personal.wxss */
/* @import url("/static/main.css");
	@import url("/static/iconfont/icons.css"); */
	/* .y_cell{
		border-top: 1px solid #eee;
	    border-bottom: 1px solid #eee;
		display: flex;
		align-items: center;
		justify-content: space-between;
		height: 65rpx;
	} */
	
	.y_cell_left{
		margin-left: 10rpx;
	}
	
	.y_cell_right{
		margin-right: 10rpx;
	}
	
	
	
	

	.header {
		display: flex;
		/* justify-content: space-between; */
		justify-content: space-between;
		box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
	}


	.headshot {
		margin-top: 10rpx;
		margin-bottom: 10rpx;
		flex: 1;
		margin-left: 30rpx;
	}



	.head-right {
		margin-top: 10rpx;
		flex: 2;
		padding-right: 40rpx;
	}

	.myexam {
		width: 208rpx;
		height: 50rpx;
		margin-top: 20rpx;
		margin-bottom: 20rpx;
		background: rgb(255, 105, 180);
		text-align: center;
		line-height: 50rpx;
		color: #fff;
		font-size: 18px;
		border-radius: 0px 50px 50px 0px;
	}

	.myexam_2 {
		background: rgb(221, 160, 221);
	}

	.quitBtn {
		width: 94%;
		margin-left: 3%;
		position: relative;
		bottom: 10rpx;
		padding-bottom: 80rpx;
	}

	.box {
		margin: auto;

	}
</style>